﻿define('departments',
    ['jquery', 'ko', 'basicObject', 'department', 'departmentsSearch'],
function ($, ko, basicObject, department, departmentsSearch) {
    var departments = function() {
        var self = this;
        var dateCellTemplate = '<span data-bind="css: \'kgCellText\', dateshower: $data.getProperty($parent)" />';
        var linkCellTemplate = '<div style="width: 100px"><a data-bind="css: \'kgCellText fill\'">Edit<a></div>';
        var columnsDefs = [
            { field: 'code', displayName: 'Code', width: '15%' },
            { field: 'title', displayName: 'Title', width: '43%' },
            { field: 'createdOn', cellTemplate: dateCellTemplate, displayName: 'Created On', width: '20%' },
            { field: 'id', cellTemplate: linkCellTemplate, displayName: 'Edit', width: '15%' }
        ];
       
            self.basicObject = ko.observable(new basicObject(columnsDefs, department, departmentsSearch, "/api/Departments/GetByPage", "currentView", "Department"));
        
    };

    return departments;

});